import http from './axios'

export function Base64DownLoader (options) {
  this.options = options
  this.isBase64DownLoader = true
}
export function BaseDownLoader (options) {
  this.options = options
}
Object.assign(Base64DownLoader.prototype, {
  loadByPath (path) {
    return new Promise((resolve, reject) => {
      http.get(path).then(response => {
        resolve(`data:${response.contentType};base64,` + response.base64, response.filename)
      })
    })
  }
})
Object.assign(BaseDownLoader.prototype, {
  loadByPath (path) {
    return new Promise((resolve, reject) => {
      resolve(path)
    })
  }
})